package com.mm.bo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

/**
 * @ClassName CategoryselectBo
 * @Description TODO
 * @Author 任昊
 * @Date 2020/12/7 11:13
 */

@Data
@ApiModel(value = "查询物资种类传入参数",description = "查询物资种类传入参数")
public class CategorySearchBo {

    @ApiModelProperty(value = "查询条件(种类编号、种类名称)",example = "种类编号、种类名称")
    private String searchInfo;

    @ApiModelProperty(value = "当前页",example = "1",required = true)
    @NotNull(message = "pageIndex不能为空")
    @Min(value = 1, message = "pageIndex最小为1")
    private Integer pageIndex;

    @ApiModelProperty(value = "当前页大小",example = "10",required = true)
    @NotNull(message = "pageSize不能为空")
    @Min(value = 1, message = "pageSize最小为1")
    private Integer pageSize;

    public Integer getPageIndex() {
        if (pageIndex < 1) {
            pageIndex = 0;
            return pageIndex;
        } else {
            return (pageIndex - 1) * pageSize;
        }
    }
}
